<template>
	<view id="domxee-content" :class="globalData.defaultThemes">
		<view id="header_wrapper">
			<nii-navbar :globalData="globalData" :scroll="scroll">
			</nii-navbar>
		</view>
		<view id="content_wrapper">
			<view class="d-flex j-sb px-40 py-20 bg-ff433a text-white">
				<view class="d-flex flex-column">
					<view class="font-26">
						顾客数量
					</view>
					<view class="d-flex a-end">
						<view class="font-50">
							0
						</view>
						<view class="font-26 pb-10">
							人
						</view>
					</view>
				</view>
				<view class="iconfont icon-tuanduizhanghao font-72"></view>
			</view>
			<view class="">
				<view class="d-flex py-20 border-bottom-01 bg-white">
					<view class="flex-1 text-center color-ff433a">
						老顾客(0)
					</view>
					<view class="flex-1 text-center">
						新顾客(0)
					</view>
				</view>
				<view class="d-flex px-30 py-10 bg-white ">
					<input type="text" class="flex-1 bg-f5f5f5 b-r30 py-5" placeholder="点击搜索会员名称" placeholder-class="font-24 text-center color-a8a8a8" />
					<view class="iconfont icon-sousuo  font-30 ml-20"></view>
				</view>
				<view class="d-flex j-sb a-center bg-white font-24 px-40 py-10 mt-5">
					<view class="d-flex a-center">
						<view class="">
							团队排序
						</view>
						<view class="iconfont icon-zhuanhuan-yuan-shangxia-F ml-10 font-24"></view>
					</view>
					<view class="d-flex a-center">
						<view class="">
							金额排序
						</view>
						<view class="iconfont icon-zhuanhuan-yuan-shangxia-F ml-10 font-24"></view>
					</view>
					<view class="d-flex a-center">
						<view class="">
							订单排序
						</view>
						<view class="iconfont icon-zhuanhuan-yuan-shangxia-F ml-10 font-24"></view>
					</view>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				globalData: {windowWidth: 0, statusBarHeight: 0, navHeight: 0, navigationBarHeight: 0, wechatCapsule: {width: 0, height: 0, top: 0, right: 0, bottom: 0, left: 0}, defaultThemes: [], colors: {}, configs: {} },
				scroll: 0,
				current_page: {route: '', params: {}, url: ''},
				ready: false,
				options: {

				},
				styles: {
					
				},
				shows: {
					services: false,
					autoShow: false
				},
				renders: {
					activity1: {enable: false, name: '', img: '', alias: 'none', params: {}},
					activity2: {enable: false, name: '', img: '', alias: 'none', params: {}},
					activity3: {enable: false, name: '', img: '', alias: 'none', params: {}},
					infos: {avatar: '', nickname: '', rows: [], mode_one_level_name: '', mode_three_level_name: '', idents: [], qr: {enable: false, text: '', alias: 'none', params: {}}},
					vip: {enable: false, text: '', button: '', alias: 'none', params: {}},
					ad: false, 
					statistics: {enable: false, lists: [{name: '', text: '', alias: 'none', params: {}}]},
					sections: {
						orders: {enable: false, title: '', more: '', alias: 'none', params: {}, lists: [{name: '', img: '', alias: 'none', params: {}, count: 0}]},
						fans: {enable: false, title: '', lists: [{enable: false, name: '', img: '', alias: 'none', params: {}}]},
						tools: {enable: false, title: '', lists: [{name: '', img: '', alias: 'none', params: {}}]},
						lists: {enable: false, title: '', lists: []},
					},
					popups: {
						autoShow: {enable: false, img: '', width: 0, height: 0, alias: 'none', params: {}, force: false},
						services: {title: '', lists: [], tel: ''},
					}
				},
				data: {
					sections: {

					},
				},
			}
		},
		onReady() {						//页面渲染完毕后操作（动态获取/调整元素宽高位置等需在ready后获取最为准确）
			//设置对象
			let that = this;

		},
		onShow() {						//页面显示后操作（关闭、后台运行等操作后重新打开访问触发、可在实时性较高操作页面进行全页刷新）
			//设置对象
			let that = this;
			//初始数据
			that.initInformation();
		},
		onLoad(options) {				//页面加载时操作（options可获取当前页面传递参数，如：options.id）
			//设置对象
			let that = this;
			//设置当前页面数据
			that.current_page = that.nii_common.pages.getCurrentUrl();
			//设置默认数据
			that.globalData = that.nii_common.pages.initGlobalData(getApp().globalData);
			//设置参数
			that.options = options;
			//初始数据
			that.initInformation();
		},
		methods: {
			//默认跳转操作
			navigateAction: function(alias, requestParams = {}, action = 'navigate', authenticate = false, animationType = 'slide-in-right') {this.nii_common.navigate.action(alias, requestParams, action, authenticate, animationType); },
			//拨打电话
			callPhone: function(mobile) {uni.makePhoneCall({phoneNumber: mobile});},
			//复制数据
			clipboardData: function (text) {const that = this;that.nii_common.clipboardData(text);},
			initInformation: function() {
				//设置对象
				let that = this;
				//loading
				!that.ready && that.nii_common.toastLoading('加载中');
				//开始准备
				that.ready = false;				
				//发起请求
				that.nii_common.request.build('v2/user/information', that.options, 'POST', function (res) {
					//设置准备已就绪
					that.ready = true;
					//设置数据
					that.renders = res.data;
					//判断是否开启自动弹窗
					// if (that.renders.popups.autoShow.enable) {
					// 	//打开弹窗
					// 	that.shows.autoShow = true;
					// }
				}, function (res) {
					//提示错误
					that.nii_common.toastAlert(res.msg);
				}, function(res) {
					//隐藏loading
					that.nii_common.toastLoadingHide();
				}, true);	
			},
			scanAction: function() {
				let that = this;
				console.log(1);
				// 允许从相机和相册扫码
				uni.scanCode({
					scanType: ['qrCode'],
					onlyFromCamera: false,
					success: function (res) {
						console.log(res);
						console.log('条码类型：' + res.scanType);
						console.log('条码内容：' + res.result);
						let url = res.result + '&type=gold';
						console.log(url);
						that.navigateAction(url, {}, '', true);
						// uni.navigateTo({
						// 	url: url
						// });
						// if(!uni.$u.test.isEmpty(res.result)){
						// 	uni.navigateTo({
						// 		url: res.result + '&type=gold'
						// 	});
						// }
					}
				});
			},
			// requestDemo: function() {
			// 	//获取对象
			// 	const that = this;
			// 	//loading
			// 	that.nii_common.toastLoading('处理中...');
			// 	//发起请求
			// 	that.nii_common.request.build('', {}, 'POST', function (res) {
			// 		//提示成功
			// 		that.nii_common.toastAlert('处理成功', 'success');
			// 	}, function (res) {
			// 		//提示错误
			// 		that.nii_common.toastAlert(res.msg);
			// 	}, function(res) {
			// 		//隐藏loading
			// 		that.nii_common.toastLoadingHide();
			// 	});	
			// }
		},
		onPullDownRefresh(res) {
			//设置对象
			let that = this;
			
			//TODO：页面下拉刷新时的事件
			
			
			//停止刷新
			uni.stopPullDownRefresh();	
		},
		onReachBottom() {
			//设置对象
			let that = this;
			
			//TODO：页面滑动触底时的事件
			
		},
		onPageScroll: function(e) {
			//设置页面滑动高度
			this.scroll = e.scrollTop

			//TODO：需判断滑动高度后处理的事件

		}
	}

</script>

<style lang="scss">
	page{
		background-color: #f5f5f5;
	}
	#header_wrapper {
		position: relative;
		z-index: 10;
		overflow: hidden;
		#infos {
			margin-top: 30rpx;
			.infos {
				.infos_box {
					.info {
						.avatar_box {
							width: 160rpx;
							height: 160rpx;
							border-radius: 160rpx;
							margin-right: 20rpx;
						}
						.account {
							.nickname {
								font-size: 36rpx;
								line-height: 50rpx;
							}
							.rows {
								margin-top: 10rpx;
								.row {
									font-size: 24rpx;
									line-height: 34rpx;
									margin-top: 4rpx;
								}
								.row:first-child {
									margin-top: 0;
								}
							}
						}
					}
					.qr_box {
						width: 80rpx;
						.domxee_icon {
							font-size: 60rpx;
							line-height: 60rpx;
							margin: 0 auto;
						}
						.text {
							margin-top: 10rpx;
							font-size: 24rpx;
							line-height: 34rpx;
						}
					}
				}
				.idents {
					margin-left: 180rpx;
					margin-top: 10rpx;
					.ident {
						padding: 0 20rpx;
						height: 44rpx;
						background: rgba(0,0,0,0.3);
						border-radius: 20rpx;
						line-height: 44rpx;
						font-size: 24rpx;
						color: #F5DEB5;
						margin-right: 20rpx;
						margin-top: 20rpx;
					}
					.level {
						.domxee_icon {
							margin-right: 8rpx;
							font-size: 30rpx;
						}
					}
				}
			}
		}
		#vip {
			margin-top: 30rpx;
			.vip {
				.vip_box {
					background: linear-gradient(132deg, #FFEACB 0%, #E7D2A7 100%);
					box-shadow: 2rpx 2rpx 0rpx 0rpx #ECD6B1;
					border-radius: 20rpx;
					padding: 20rpx;
					.left {
						.domxee_icon {
							font-size: 40rpx;
							margin-right: 20rpx;
							line-height: 34rpx;
							color: #593C24;
						}
						.text {
							font-size: 24rpx;
							color: #593C24;
							line-height: 34rpx;
						}
					}
					.button {
						width: max-content;
						height: 40rpx;
						background: #CBAF80;
						border-radius: 20rpx;
						padding: 0 20rpx;
						font-size: 24rpx;
						color: #593C24;
						line-height: 40rpx;
					}
				}
			}
		}
		#statistics {
			margin-top: 30rpx;
			.statistics {
				.statistics_box {
					padding: 0 20rpx 40rpx 20rpx;
					border-radius: 20rpx;
					.contents {
						.item {
							margin-right: 10rpx;
							margin-top: 40rpx;
							width: 160rpx;
							.name {
								font-size: 24rpx;
								line-height: 34rpx;
							}
							.text {
								margin-top: 44rpx;
								font-size: 30rpx;
								line-height: 40rpx;
							}
						}
						.item:nth-of-type(4n) {
							margin-right: 0;
						}
					}
				}
			}
		}
	}
	#header_wrapper::after {
		content: '';
		width: 140%;
		height: 100%;
		position: absolute;
		left: -20%;
		top: 0;
		z-index: -1;
		border-radius: 0 0 50% 50%;
		background: linear-gradient(135deg, #FE623F 0%, #FF2A36 100%);
	}
	#content_wrapper {
		padding-bottom: 300rpx;
		#orders {
			margin-top: 30rpx;
			.orders {
				.orders_box {
					padding: 30rpx 20rpx;
					border-radius: 20rpx;
					.titles {
						.title {
							font-size: 32rpx;
							line-height: 44rpx;
						}
						.more {
							font-size: 24rpx;
							line-height: 34rpx;
						}
					}
					.lists {
						margin-top: 50rpx;
						.list {
							position: relative;
							.item {
								width: 120rpx;
								.cover_box {
									margin: 0 auto;
									width: 60rpx;
									height: 60rpx;
								}
								.name {
									margin-top: 10rpx;
									font-size: 24rpx;
									line-height: 34rpx;
								}
							}
							.count {
								position: absolute;
								top: -20rpx;
								right: 0;
								width: 30rpx;
								height: 30rpx;
								border-radius: 30rpx;
								font-size: 24rpx;
								line-height: 30rpx;
							}
						}
						
					}
				}
			}
		}
		#fans {
			margin-top: 30rpx;
			.fans {
				.fans_box {
					padding: 30rpx 20rpx;
					border-radius: 20rpx;
					.title {
						font-size: 32rpx;
						line-height: 44rpx;
					}
					.lists {
						margin-top: 50rpx;
						.list {
							width: 120rpx;
							.cover_box {
								margin: 0 auto;
								width: 60rpx;
								height: 60rpx;
							}
							.name {
								margin-top: 10rpx;
								font-size: 24rpx;
								line-height: 34rpx;
							}
						}
					}
				}
			}
		}
		#ad {
			margin-top: 30rpx;
		}
		#tools {
			margin-top: 30rpx;
			.tools {
				.tools_box {
					padding: 30rpx 20rpx;
					border-radius: 20rpx;
					.title {
						font-size: 32rpx;
						line-height: 44rpx;
					}
					.lists {
						// margin-top: 50rpx;
						.list {
							margin: 50rpx 16rpx 0 0;
							width: 120rpx;
							.cover_box {
								margin: 0 auto;
								width: 60rpx;
								height: 60rpx;
							}
							.name {
								margin-top: 10rpx;
								font-size: 24rpx;
								line-height: 34rpx;
							}
						}
					}
				}
			}
		}
		#lists {
			margin-top: 30rpx;
			.lists {
				.lists_box {
					.titles {
						.line {
							margin-right: 20rpx;
							width: 10rpx;
							height: 30rpx;
						}
						.title {
							font-size: 36rpx;
							line-height: 50rpx;
						}
					}
				}
			}
		}
			
	}
	#services_popup {
		padding-bottom: 100rpx;
		.title {
			font-size: 36rpx;
			line-height: 50rpx;
		}
		.descriptions {
			margin-top: 80rpx;
			.desc {
				margin-top: 40rpx;
				font-size: 28rpx;
				line-height: 40rpx;
			}
			.desc:first-child {
				margin-top: 0;
			}
		}
	}
	#services_popup_contact {
		width: 580rpx;
		margin: 40rpx auto 0 auto;
		.contact_button {
			padding: 28rpx;
			font-size: 32rpx;
			line-height: 44rpx;
		}
	}
	#autoShow_popup {
		.img_box {
			margin: 0 auto;
		}
	}
</style>
